import pandas
import pandas as pd
import numpy as np
from sqlalchemy import create_engine
def shujuduqu():
    global junzhi
    global minOne
    global maxOne
    engine = create_engine('mysql+pymysql://root:123456@localhost:3306/pythondata')
    # 查询语句，选出employee表中的所有数据
    sql = ''' select kmnumber from test; '''
    # read_sql_query的两个参数: sql语句， 数据库连接
    df = pd.read_sql_query(sql, engine)
    print(type(df))
    # pd.
    # df = np.array(df)  # 先将数据框转换为数组
    # # np.
    # df = df.tolist()
    # for row in df:
    #     row = row[:-3]
    #     print(row)
    # print(df)
    df1 = df['kmnumber'].value_counts()

    df1 = df1[:14]
    print(df1)


    df1 = np.array(df1)
    print(df1)
    print(type(df1))


shujuduqu()
